<?php #coding: utf-8 æ ø å 

/*Skal kaldes med variablene:
$stat_pot og
$stat_temp
hvoraf een vil være til at blive redigeret.
*/

?>
<?php
if($aktion == "1_slaa_temp_ini")
{

	?>
	<form action="<? echo base_url() ?>karakterark/stats/<? echo $id; ?>" method="post">
		<input type="hidden" name="aktion" value="2_slaa_pot_ini">
		<table class="rubrik" style="text-align:center">
			<tr>
			<td></td>
			<td width="40px"><p class="rubrik"><b>temp</b></p></td>
			<td width="40px"><p class="rubrik"><b>pot</b></p></td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_1" value="<? if(!empty($stat_pot)){echo $stat_pot['Lu'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_2" value="<? if(!empty($stat_pot)){echo $stat_pot['Co'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_3" value="<? if(!empty($stat_pot)){echo $stat_pot['Ag'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_4" value="<? if(!empty($stat_pot)){echo $stat_pot['Re'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_5" value="<? if(!empty($stat_pot)){echo $stat_pot['Me'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_6" value="<? if(!empty($stat_pot)){echo $stat_pot['SD'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_7" value="<? if(!empty($stat_pot)){echo $stat_pot['St'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_8" value="<? if(!empty($stat_pot)){echo $stat_pot['Qu'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_9" value="<? if(!empty($stat_pot)){echo $stat_pot['Em'];} ?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_10" value="<? if(!empty($stat_pot)){echo $stat_pot['Pr'];}?>"/></td>
			<td>?</td>
			</tr>
			<tr>
			<td></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="temp_11" value="<? if(!empty($stat_pot)){echo $stat_pot['In'];} ?>"/></td>
			<td>?</td>
			</tr>
		</table>
		<input class="rubrik" type=submit value="<? echo 'Godkend'; ?>"/>
	</form>
<!--script type="text/javascript" src="<? echo base_url(); ?>/scripts/tjek/stat_form_tjek.js"></script-->

	<?
} 
elseif($aktion == "2_slaa_pot_ini")
{
	?>
	<form action="<? echo base_url() ?>karakterark/stats/<? echo $id; ?>" method="post">
		<input type="hidden" name="aktion" value="3_placer_stats">
		<input type="hidden" name="temp_1" value="<? echo $temp_1 ?>">
		<input type="hidden" name="temp_2" value="<? echo $temp_2 ?>">
		<input type="hidden" name="temp_3" value="<? echo $temp_3 ?>">
		<input type="hidden" name="temp_4" value="<? echo $temp_4 ?>">
		<input type="hidden" name="temp_5" value="<? echo $temp_5 ?>">
		<input type="hidden" name="temp_6" value="<? echo $temp_6 ?>">
		<input type="hidden" name="temp_7" value="<? echo $temp_7 ?>">
		<input type="hidden" name="temp_8" value="<? echo $temp_8 ?>">
		<input type="hidden" name="temp_9" value="<? echo $temp_9 ?>">
		<input type="hidden" name="temp_10" value="<? echo $temp_10 ?>">
		<input type="hidden" name="temp_11" value="<? echo $temp_11 ?>">
		
	<table class="rubrik" style="text-align:center">
			<tr>
			<td></td>
			<td width="40px"><p class="rubrik"><b>temp</b></p></td>
			<td width="40px"><p class="rubrik"><b>pot</b></p></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_1; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_1" value=""></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_2; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_2" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_3; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_3" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_4; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_4" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_5; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_5" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_6; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_6" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_7; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_7" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_8; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_8" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_9; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_9" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_10; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_10" value=""/></td>
			</tr>
			<tr>
			<td></td>
			<td><? echo $temp_11; ?></td>
			<td><input type="text" style="width:40px;font-weight:bold;" class="ink" name="pot_11" value=""/></td>
			</tr>
		</table>
		<input class="submit" type=submit value="<? echo 'Godkend'; ?>"/>
	</form>
	<?
} 
elseif($aktion == "3_placer_stats")
{
	$stat_names = array("Lu","Co","Ag","Re","Me","SD","St","Qu","Pr","Em","In");
		?>
	<form action="<? echo base_url() ?>karakterark/stats/<? echo $id; ?>" method="post">
		<input type="hidden" name="aktion" value="4_tilfoej_stats_ini">
		<? 
		$count = 1;
		while($count < 12)
		{
			?><input type="hidden" name="temp_<? echo $count; ?>" value="<? echo $temp[$count]; ?>"><?
			$count = $count +1;
		}
		$count = 1;
		while($count < 12)
		{
			?><input type="hidden" name="pot_<? echo $count; ?>" value="<? echo $pot[$count]; ?>"><?
			$count = $count +1;
		}		
		?>
		
<table class="rubrik" style="text-align:center">
			<tr>
			<td></td>
			<td width="40px"><p class="rubrik"><b>temp</b></p></td>
			<td width="40px"><p class="rubrik"><b>pot</b></p></td>
			</tr>

			
			<? 
			$count = 1;
			while($count < 12)
			{
				//echo $stat_name[$count];
				?>
					<tr>
					<td><select name="<? echo "stat_".$count; ?>">
					<option value="tom" selected>Vælg</option>
				<?
				foreach($stat_names as $r)
				{
					?><option value="<? echo $r; ?>"><? echo $r;?></option><?
					
				}
				?>
				</select></td>
				<td><? echo $temp[$count]; ?></td>
				<td><? echo $pot[$count]; ?></td>
				</tr>
				<?
				$count = $count +1;
			}
			?>
			
			
		</table>
		<input class="submit" type=submit value="<? echo 'Gem stats'; ?>"/>
	</form>
	<?
	
}
elseif($level != 0)
{
	$stat_names = array("Lu","Co","Ag","Re","Me","SD","St","Qu","Pr","Em","In");
	?>
	<form action="<? echo base_url() ?>karakterark/stat_gain/<? echo $id; ?>/<? echo $level; ?>" method="post">
		<input type="hidden" name="aktion" value="stat_gain">
		<input type="hidden" name="level" value="<?echo $level;?>">
<table class="rubrik" style="text-align:center;width:60px;">
			<tr>
			<td></td>
			<td ><p class="rubrik"><b>temp gain</b></p></td>
			<td ><p class="rubrik"><b>pot gain</b></p></td>
			</tr>
			<?
			foreach($stat_names as $r)
			{
			?>	
				<tr>
				<td><? echo $r; ?></td>
				<td><input type="text" style="width:30px;font-weight:bold;" class="ink" name="temp_<? echo $r; ?>" value=""/></td>
				<td><? if($stat_pot_vis[$r] == $stat_temp_vis[$r])
				{
					?><input type="text" style="width:30px;font-weight:bold;" class="ink" name="pot_<? echo $r; ?>" value=""/><?
				} ?></td>
				</tr>
			<?
			}
			?>
		</table><br>
		<input style="float:right;" class="submit" type=submit value="<? echo 'Gain'; ?>"/>
	</form>
	<?
}


if(isset($fejlbesked_stats))
{
	echo $fejlbesked_stats;
}
	
?>


